package com.guchenbo.nacos.spring.boot;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/config-refresh")
@RefreshScope
public class ConfigRefreshController {

    @Value(value = "${config.key}")
    private String configKey;

    @GetMapping(value = "/get")
    @ResponseBody
    public String get() {
        return configKey;
    }
}
